package com.fms.gui.existingSheets;

import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.SwingConstants;
import javax.swing.table.TableCellRenderer;

public class CenteredTextRenderer extends JLabel implements TableCellRenderer
{
	/**
	 * 
	 */
	private static final long	serialVersionUID	= -6513908973070486037L;

	public CenteredTextRenderer()
	{
		this.setHorizontalAlignment(SwingConstants.CENTER);
	}

	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column)
	{
		if(value instanceof String)
		{
			this.setText((String) value);
		}
		else
		{
			this.setText("NA");
		}
		return this;
	}

}
